import Tokenizer from "../tokenizer/Tokenizer";
import StringIter from "../tokenizer/StringIter";
import {TokenType} from "../tokenizer/TokenType";
import {Analyser} from "../analyser/Analyser";
import JsonToXml from "../utils/JsonToXml";


const json = [
    {
        "id": "1718541076416966657",
        "name": "11",
        "code": "11",
        "icon": "icon_16985670894552023-10-29830.jpg",
        "description": "11"
    }, {
        "id": "1718541186240622593",
        "name": "22",
        "code": "22",
        "icon": "icon_16985671199322023-10-29738.jpg",
        "description": "22"
    }, {
        "id": "1718541229240627201",
        "name": "33",
        "code": "33",
        "icon": "icon_16985671272142023-10-29616.jpg",
        "description": "33"
    }, {
        "id": "1718541268398649346",
        "name": "44",
        "code": "44",
        "icon": "icon_16985671369532023-10-29899.jpg",
        "description": "44"
    }, {
        "id": "1718552313326485505",
        "name": "55",
        "code": "44",
        "icon": "icon_16969303280042023-10-10438.jpg",
        "description": "44"
    }]


// let token = tokenizer.nextToken();
// while (token.tokenType !== TokenType.EOF) {
//     console.log(`${token.tokenType.toString()}--${token.value}---${token.startPos.toString()}`)
//     token = tokenizer.nextToken();
// }
const xml = JsonToXml("root", {json});

console.log(xml)

let tokenizer = new Tokenizer(new StringIter(xml));
let analyser = new Analyser(tokenizer);
analyser.analyseAllTag()
console.log(analyser.analyseAllTag())



